package psd.scala.rules
import scala.collection.mutable
import scala.collection.JavaConversions._
import psd.model.Bug
import org.eclipse.jdt.core.dom.Modifier
import psd.scala.FactDb
import psd.scala.facts.FieldDefT

class AvoidConstantsInInterface (description: String) extends AbstractRule (description){
	
   def execute(db: FactDb): mutable.ArrayBuffer[Bug]= {
    
     val classDefTlist = db.classDefTList.filter(_.isInterface)
   	   	 
   	 val result = new mutable.ArrayBuffer[Bug]
   	 
   	 for ( interface <- classDefTlist ) {
   	   
   		 val fieldDefTList = db.fieldDefTList.filter(_.path == interface.path)
   		 //Modifier.isPublic(fd.modifier) && Modifier.isStatic(fd.modifier) && !Modifier.isFinal(fd.modifier)
   		 if (true){   		   
	   				 val bug = new Bug
				     bug.set_lineNumber(interface.line.toInt)
				     bug.set_path(interface.path)
			    	 bug.set_ruleName(this.getClass().toString())
			    	 bug.set_description(this.description)
			    	 result+=bug
	   		}
   	  	 }
	   	 return result
	  }	
}